<?php

use Elite\Infrastructure\Cache\Cache;
use Elite\Infrastructure\Config\Config;

class OnWorkStartListener extends Elite\Infrastructure\Server\Listener\OnWorkStartListener {

    public function callback() {
//        var_dump(get_included_files());
        $server = func_get_arg(0);
        $workerId = func_get_arg(1);
        parent::callback($server, $workerId);
        include_once ROOT_DIR . "/bootstrap/WebBootstrap.php";
        (new WebBootstrap())->preload($this->swoole);
        // 需要定时器则启动
//        $this->startTimer($workerId, $server, app()->get(Config::class), function($hostname, $runtimeIdMap) {
//            /** @var Cache $cache */
//            $cache = app()->get(Cache::class);
//            $cache->set("timer:runtime:$hostname", json_encode($runtimeIdMap), 3600); // Store status info in cache for 1 hour
//        });
    }

}